package Map
{
	public class CMapData
	{
		private var m_arrMapData :Array;
		private var m_nMapSizeX :uint;
		
		public function get nMapSizeX() :uint { return m_nMapSizeX; }
		public function get nMapSizeY() :uint { return m_arrMapData.length; }
		
		public function CMapData()
		{
			m_arrMapData = new Array();
			m_nMapSizeX = 0;
		}
		public function Clear() :void
		{
			for (var iRow :uint = 0; iRow < m_arrMapData.length; ++iRow)
			{
				var arrMapTileRow :Array = m_arrMapData[iRow] as Array;
				for (var iCol :uint = 0; iCol < arrMapTileRow.length; ++iCol)
				{
					arrMapTileRow[iCol] = null;
				}
				arrMapTileRow.splice(0, arrMapTileRow.length);
				m_arrMapData[iRow] = null;
			}
			m_arrMapData.splice(0, m_arrMapData.length);
		}
		public function Push(arrColData :Array) :void
		{
			m_arrMapData.push(arrColData);
			SetMapSizeX(arrColData.length);
		}
		public function GetMapTileType(nMapPosX :int, nMapPosY :int) :uint
		{
			if (m_arrMapData[nMapPosY] == null) return 0;
			return m_arrMapData[nMapPosY][nMapPosX];
		}
		private function SetMapSizeX(nMapSizeX :uint) :void
		{
			if (m_nMapSizeX < nMapSizeX) m_nMapSizeX = nMapSizeX;
		}

	}
}